package com.example.wendao.model.service;

import androidx.lifecycle.LiveData;
import androidx.paging.DataSource;

import com.example.wendao.model.db.dao.ForumTagDao;
import com.example.wendao.model.db.database.AppDatabase;
import com.example.wendao.model.entity.Forum;
import com.example.wendao.model.entity.ForumTag;


public class ForumTagService {

    private ForumTagDao forumTagDao;

    public ForumTagService() {
        forumTagDao= AppDatabase.getDatabases().getForumTagDao();
    }

    /*
     * param:标签
     * return:空
     * */
    public void addTag(ForumTag forumtag) { forumTagDao.addTag(forumtag); }

    /*
     * param:标签id
     * return:标签
     * */
    public ForumTag findForumTagByTagId(int tagid) {
            return forumTagDao.findForumTagByTagId(tagid);
        }
    /*
     * param:标签名
     * return:分页标签列表的数据源工厂
     * */
        public DataSource.Factory<Integer, ForumTag> findForumTagByTagName(String tagname) {
            return forumTagDao.findForumTagByTagName(tagname);
        }

    /*
     * param:标签id
     * return:标签下帖子数量
     * */
        public int findForumTagCountByTagId(int tagid) {
            return forumTagDao.findForumTagCountByTagId(tagid);
        }

    /*
     * param:标签id
     * return:空
     * */
        public void addForumTagCountByTagId(int tagid) {
            forumTagDao.addForumTagCountByTagId(tagid);
        }

    /*
     * param:空
     * return：分页热门帖子列表的数据源工厂
     * */
        public DataSource.Factory<Integer, ForumTag> findForumTagByHeat() {
            return forumTagDao.findForumTagByHeat();
        }

    }
